
const tel=$("#tel");
const remoney=$("#remoney");
const money=$("#money");
const pwd=$("#pwd");

$(".btn").click( function () {
    $("#remoney").attr("value", "")
    var value = $(this).attr("value");
    if (value == 0) {
        $("#remoney").attr("placeholder", "请输入退费金额:");
        $("#remoney").focus();
    } else $("#remoney").attr("value", value);
});


$("#btn01").click(function (){
        if (pwd.val() === "") {
            pwd.addClass("input change");
            pwd.attr("placeholder", "密码不能为空");
            return;
        }
        if (remoney.val() === "") {
            remoney.addClass("input change");
           remoney.attr("placeholder", "退费金额不能为空");
           return;
        }

        if(money.innerText<remoney.val()){
            remoney.val(null);
            remoney.addClass("input change");
            remoney.attr("placeholder", "退费金额不可大于余额!");
            return;
        }
$.ajax({
    url: "/users/Return",
    type: "post",
    data: {
        tel: tel.val(),
        remoney: remoney.val(),
        pwd:pwd.val()
    },
    success: function (Result) {
        alert(Result.msg);
        if(Result.code===20011){
            window.location.href="/users/userreturn";
        }
    },
    error: function () {
        alert("修改失败,系统忙,请稍后重试!");
    }
});
});
